import express from "express"
import { 
  userLogin,
  getMe,
  userRegister,
  putMe,
  getUsers,
  getUserById,
  delUserById,
  putUserById
} from "../controllers/user.js"
import { admin, protect } from "../middleware/auth.js"

const router = express.Router()

router.post("/register",userRegister)
router.post("/login",userLogin)
router.route('/me').get(protect,getMe).put(protect,putMe)
router.get("/paging/list", protect, admin, getUsers)
router.route("/:id").get(protect, admin, getUserById).delete(protect, admin,delUserById).put(protect, admin,putUserById)


export default router